<?php
require_once("Smarty/Smarty.class.php");
class lib_view extends Smarty
{
	public function __construct($config=array())
	{
		global $__view__;
		$this->Smarty();
		$this->template_dir = TEMPLATE_DIR;
		$this->compile_dir = VIEW_COMPILE_DIR;
		$this->plugins_dir[] = $this->template_dir.'plugins/';
		if (!is_dir($this->compile_dir))
		{
			lib_utils::mkdir($this->compile_dir, 0777);
		}
		$this->cache_dir = VIEW_CACHE_DIR;
		if (!is_dir($this->cache_dir))
		{
			lib_utils::mkdir($this->cache_dir, 0777);
		}
		$this->left_delimiter = "<!--{";
		$this->right_delimiter = "}-->";

		if (isset($__view__['compile_check']))
		{
			$this->compile_check = $__view__['compile_check'];
		}
		if (isset($__view__['force_compile']))
		{
			$this->force_compile = $__view__['force_compile'];
		}
		if (isset($__view__['caching']))
		{
			$this->caching = $__view__['caching'];
		}
		if (isset($__view__['debugging']))
		{
			$this->debugging = $__view__['debugging'];
		}
	}

	public function go($url, $msg, $time = 2)
	{
		$this->assign("url", $url);
		$this->assign("msg", $msg);
		$this->assign("time", $time);
		$this->display("alarm.html");
		exit();
	}

	public function alert($msg, $url = '')
	{
		$this->assign('msg', $msg);
		$this->assign('url', $url);
		$this->display('msg.html');
		exit();
	}
}
?>
